package com.gz.droolsrule.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gz.droolsrule.dao.BaseRuleActionParamInfoMapper;
import com.gz.droolsrule.pojo.BaseRuleActionParamInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: RuleActionParamInfoService <br/>
 * Description: <br/>
 * date: 2019/5/31 16:01<br/>
 *
 * @author gz<br />
 * @since JDK 1.8
 */
@Service
public class RuleActionParamInfoService {
    @Autowired
    private BaseRuleActionParamInfoMapper baseRuleActionParamInfoMapper;
    /**
     * 方法说明: 获取动作参数信息
     *
     * @param baseRuleActionParamInfo 参数
     * @param page                    分页参数
     */

    public PageInfo<BaseRuleActionParamInfo> findBaseRuleActionParamInfoPage(BaseRuleActionParamInfo baseRuleActionParamInfo, PageInfo page) {
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        List<BaseRuleActionParamInfo> list = this.baseRuleActionParamInfoMapper.findBaseRuleActionParamInfoList(baseRuleActionParamInfo);
        return new PageInfo<>(list);
    }
    /**
     * 方法说明: 根据动作id获取动作参数信息
     *
     * @param actionId 参数
     */
    public List<BaseRuleActionParamInfo> findRuleActionParamByActionId(Long actionId) {
        if (null == actionId) {
            return null;
        }
        return this.baseRuleActionParamInfoMapper.findRuleActionParamByActionId(actionId);
    }
}
